import { Injectable } from '@angular/core';
import { OutputDesignClassItem } from './outputdesignclassitem';
import { InitDesignClassItem } from './initdesignclassitem';
import { Observable, of } from 'rxjs';
import { MessageService } from '../../message.service';
import { HttpClient, HttpHeaders } from '@angular/common/http';

@Injectable({
  providedIn: 'root',
})
export class OutputDesignClassService {
  constructor(private http: HttpClient, private messageService: MessageService) { }

  register(outputDesignClassItem: OutputDesignClassItem): Observable<any> {

    const outputDesignClassItemb = JSON.stringify(outputDesignClassItem);
    return this.http.post('registerClass', outputDesignClassItemb,
      { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), responseType: 'blob', observe: 'response' });
  }

  searchByClassID(screenId: string, classId: string): Observable<OutputDesignClassItem> {
    const data = {
      'screenId': screenId,
      'classId': classId
    };
    return this.http.get<OutputDesignClassItem>("searchByClassID", { params: data });
  }
}
